﻿using Moq;
using NUnit.Framework;

namespace LogManager.Utils.ChangeTracking
{
    public class TestPropertyChangeBase
    {
        [Test]
        public void PropertyChangeBase_RaisePropertyChanged_CallMethod_PropertyChangedRaised()
        {
            var propertyBaseMock = new Mock<PropertyChangeBase>() { CallBase = true };
            bool propertyChangedCalled = false;
            propertyBaseMock.Object.PropertyChanged += (sender, args) =>
            {
                propertyChangedCalled = true;
                Assert.AreEqual(args.PropertyName, "PropNameSample");
                Assert.AreEqual(sender, propertyBaseMock.Object);
            };

            propertyBaseMock.Object.RaisePropertyChanged("PropNameSample");

            Assert.AreEqual(propertyChangedCalled, true);
        }
    }
}
